struct Light
{
	float3 pos;
	float  range;
	float3 dir;
	float cone;
	float3 att;
	float4 ambient;
	float4 diffuse;
};
struct VS_OUTPUT
{
	float4 Pos : SV_POSITION;
	float2 TexCoord : TEXCOORD;
	float3 normal : NORMAL;
};
struct VS_INPUT
{
	float4 Pos: POSITION;
	float2 TexCoord: TEXCOORD;
	float3 normal : NORMAL;
};
cbuffer ObjViewBuffer : register(b0)
{
	row_major matrix PVW;
	row_major matrix World;
};
cbuffer LightBuffer : register(b1)
{
	Light light;
};
Texture2D NormalMap : register(t0);

SamplerState Sampler0 : register(s0);
SamplerState Sampler1 : register(s1);
SamplerState Sampler2 : register(s2);
SamplerState Sampler3 : register(s3);

VS_OUTPUT VS(VS_INPUT v)
{
	VS_OUTPUT output;
	output.Pos = mul(PVW, v.Pos);
	output.TexCoord.x = v.TexCoord.x;
	output.TexCoord.y = v.TexCoord.y;
	output.normal = mul(World, v.normal);
	return output;
}

float4 PS(VS_OUTPUT input) : SV_TARGET
{
	//input.normal = normalize(input.normal);
	////float4 diffuse = ObjTexture.Sample(Sampler0, input.TexCoord);
	//float4 diffuse = float4(1.0f, 1.0f, 1.0f, 0.0f);
	//float3 finalColor;
	//finalColor = diffuse * light.ambient;
	//finalColor += saturate(-1.0f * dot(light.dir, input.normal) * light.diffuse * diffuse);
	//return float4(finalColor, diffuse.a);
	return NormalMap.Sample(Sampler0, input.TexCoord);
}

float4 D2D_PS(VS_OUTPUT input) : SV_TARGET
{
	return NormalMap.Sample(Sampler0, input.TexCoord);
}